To take just your second example
I wish X were here
means the same as
X is not here but I would like him to be
If there are reasons other than your personal preference for X to be present then
it would be better if X were here
would be correct.
In this case "were" has nothing to do with the past tense of "to be" but is the Subjunctive mood - https://en.wikipedia.org/wiki/Subjunctive_mood#English
"Were" for the subjunctive has largely been replaced in (British) English in favour of "was".
I wish X was here