Adding a “Sign In/My Account” link to an external app

You can read cookies both on the front- and back-end sides.

For the front-end, you have to provide both links, and show only the desired one with javascript. Use document.cookie.indexOf('cookie_name') to check the cookie presence.

For the back-end, you can read the special $_COOKIE variable to check the cookie presence in you template and change the link with this information.

The fact the your PHP application is inside WordPress will not make much difference.